#if defined(_MSC_VER)
#pragma once
#endif

#ifndef LM_FILM_IMAGEFILM_H
#define LM_FILM_IMAGEFILM_H

#include "../core/film.h"

class ImageFilm : public Film
{
public:
	ImageFilm(int xRes, int yRes, const string &fn, Reference<Filter> ft, const float crop[4]);
	void AddSamples(const Point2 &ImageSample, const Spectrum &L);
	void GetSampleExtent(int *xStart, int *yStart, int *xEnd, int *yEnd);
	void Display();
	void UpdateDisplay(int x0, int y0, int x1, int y1);
	void WriteImage() = 0;
	void Clear();
	Spectrum Get(int x, int y) const;
	std::string ToString() const {
		std::ostringstream oss;
		oss << "Exr Film :" << std::endl;
		oss << "xRes = " << xResolution << std::endl;
		oss << "yRes = " << yResolution << std::endl;
	}
	~ImageFilm();
private:
	int xPixelStart, yPixelStart, xPixelCount, yPixelCount;
	string fileName;				// filename to write to file
	float cropWindow[4];			// crop window [x0,x1,y0,y1] in NDC coordinate
	Reference<Filter> filter;		// sample filter
	BlockedArray<Pixel> *pixels;	// pixels
	BlockedArray<RGBPixel> *rgbs;	// rbg-valued pixels
};

#endif	// LM_FILM_IMAGEFILM_H